package model;

import java.util.Date;

public class Device {
	private String id;
	private String name;
	private String type;
	private String provider;
	private Date inputDay;
	private double buyPrice;
	private double sellPrice;
	private int guarantee;
	private int amount;

	public Device(String id, String name, String type, String provider,
			Date inputDay, double buyPrice, double sellPrice, int guarantee,
			int amount) {
		this.id = id;
		this.name = name;
		this.type = type;
		this.provider = provider;
		this.inputDay = inputDay;
		this.buyPrice = buyPrice;
		this.sellPrice = sellPrice;
		this.guarantee = guarantee;
		this.amount = amount;
	}

	public Device() {

	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getProvider() {
		return provider;
	}

	public void setProvider(String provider) {
		this.provider = provider;
	}

	public Date getInputDay() {
		return inputDay;
	}

	public void setInputDay(Date inputDay) {
		this.inputDay = inputDay;
	}

	public double getBuyPrice() {
		return buyPrice;
	}

	public void setBuyPrice(double buyPrice) {
		this.buyPrice = buyPrice;
	}

	public double getSellPrice() {
		return sellPrice;
	}

	public void setSellPrice(double sellPrice) {
		this.sellPrice = sellPrice;
	}

	public int getGuarantee() {
		return guarantee;
	}

	public void setGuarantee(int guarantee) {
		this.guarantee = guarantee;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	@Override
	public String toString() {
		return id;
	}

	@Override
	public boolean equals(Object obj) {
		try {
			Device that = (Device) obj;
			if (this.id.equalsIgnoreCase(that.id)
					&& this.inputDay.equals(that.inputDay)
					&& this.provider.equalsIgnoreCase(that.provider)
					&& this.name.equalsIgnoreCase(that.name)
					&& this.type.equalsIgnoreCase(that.type)
					&& this.sellPrice == sellPrice
					&& this.amount == that.amount && this.buyPrice == buyPrice
					&& this.guarantee == that.guarantee)
				return true;
		} catch (ClassCastException e) {
			e.printStackTrace();
		}
		return false;
	}

	public static void main(String[] args) {
		Device d = new Device();
		d.setId("vbvbv");

		Device f = new Device();

		System.out.println(d.equals(f));

	}
}